#include<iostream>
using namespace std;
class A
{
    public: 
        virtual void func()
        {
            cout<<"A::func()"<<endl;
        }
    private:
        int _a;
};
class B : public A
{
    public:
        virtual void  func()
        {
            cout<<"B::func"<<endl;
        }
    private:
        int _b;
};
int main()
{
    B b;
    A* a=&b;
    a->func();
    return 0;
}